#include "ScenePrecompiled.hxx"
#include "InternalSceneStaticImpl.hxx"

Eifersucht::Fbx::IOSettingsPtr Eifersucht::Scene::_Internal_static_impl::_s_pSettings = nullptr;
Eifersucht::Fbx::ManagerPtr Eifersucht::Scene::_Internal_static_impl::_s_pManager = nullptr;

Eifersucht::Scene::_Internal_static_impl::_Internal_static_impl()
{
	if ( !_s_pManager )
	{
		_s_pManager = Fbx::Manager::Create();
		_s_pSettings = Fbx::IOSettings::Create( _s_pManager, IOSROOT );

		// Those are the settings this library will support eventually
		// - Animations, bones
		// - Shapes, models

		_s_pSettings->SetBoolProp( IMP_FBX_GLOBAL_SETTINGS, true );
		_s_pSettings->SetBoolProp( IMP_FBX_ANIMATION, true );
		_s_pSettings->SetBoolProp( IMP_FBX_MATERIAL, true );
		_s_pSettings->SetBoolProp( IMP_FBX_TEXTURE, true );
		_s_pSettings->SetBoolProp( IMP_FBX_SHAPE, true );
		_s_pSettings->SetBoolProp( IMP_FBX_LINK, true );
		_s_pSettings->SetBoolProp( IMP_FBX_GOBO, true );
		_s_pSettings->SetBoolProp( IMP_FBX_MODEL, true );
		_s_pSettings->SetBoolProp( IMP_FBX_PIVOT, true );

		_s_pManager->SetIOSettings( _s_pSettings );
	}
	else
	{
		PrintToDebugWindowOnly8( 
			"Eifersucht. InternalStaticSceneImpl. "
			"Only one instance allowed."
			);
	}
}

Eifersucht::Scene::_Internal_static_impl::~_Internal_static_impl()
{
	if ( _s_pSettings ) _s_pSettings->Destroy();
	if ( _s_pManager ) _s_pManager->Destroy();
}
